<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>房联行增值服务部后台管理中心</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<link rel="stylesheet" href="./css/font.css">
		<link rel="stylesheet" href="./css/xadmin.css">
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="./js/xadmin.js"></script>
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
	    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	    <![endif]-->
	</head>
	<body>
		<div class="x-body">
			<div class="layui-tab">
				<ul class="layui-tab-title">
					<li class="layui-this">基础信息</li>
					<li>用户服务信息</li>
					<li>关于我们</li>
				</ul>
				<div class="layui-tab-content" style=" margin-top: 30px;">
					<div class="layui-tab-item layui-show">
						<form class="layui-form">
							<div class="layui-form-item">
								<label for="L_repass" class="layui-form-label">
					                <span class="x-red">*</span>客服电话
					            </label>
								<div class="layui-input-inline">
									<input type="text" id="servicePhone" name="servicePhone" required="" lay-verify="servicePhone" autocomplete="off" class="layui-input w320">
								</div>
							</div>
							<div class="layui-form-item">
								<label for="L_repass" class="layui-form-label">
					                <span class="x-red"></span>客服邮箱
					            </label>
								<div class="layui-input-inline">
									<input type="text" id="serviceEmail" name="serviceEmail"  lay-verify="serviceEmail" autocomplete="off" class="layui-input w320">
								</div>
							</div>
							<div class="layui-form-item">
								<label for="L_repass" class="layui-form-label">
					                <span class="x-red"></span>微信公众号
					            </label>
								<div class="layui-input-inline">
									<input type="text" id="weixinCode" name="weixinCode" lay-verify="weixinCode" autocomplete="off" class="layui-input w320">
								</div>
							</div>
							<div class="layui-form-item">
								<label for="L_repass" class="layui-form-label">
					                <span class="x-red"></span>公司网站
					            </label>
								<div class="layui-input-inline">
									<input type="text" id="website" name="website"  lay-verify="website" autocomplete="off" class="layui-input w320">
								</div>
							</div>
							<div class="layui-form-item">
								<label for="L_repass" class="layui-form-label">
					                <span class="x-red"></span>苹果好评地址
					            </label>
								<div class="layui-input-inline">
									<input type="text" id="address" name="address"  lay-verify="address" autocomplete="off" class="layui-input w320">
								</div>
							</div>
							<button class="layui-btn" lay-filter="set-add" lay-submit="" id="set-add" style=" margin:30px 0px 0px 110px;">提交</button>
						</form>
					</div>
					<div class="layui-tab-item">
						<form class="layui-form">
							<div class="layui-form-item">
								<label for="L_repass" class="layui-form-label font14" style=" width: 110px;padding:5px 0px 0px 0px;">用户注册协议：</label>
								<div class="layui-input-block">
								    <textarea placeholder="请输入内容" lay-verify="agreement" name="agreement" class="layui-textarea" style=" height:250px;"></textarea>
								</div>
							</div>
							<button class="layui-btn" lay-filter="agreement-add" lay-submit="" id="agreement-add" style=" margin:30px 0px 0px 110px;">提交</button>
						</form>
					</div>
					<div class="layui-tab-item">
						<form class="layui-form">
							<div class="layui-form-item">
								<label for="L_repass" class="layui-form-label font14" style=" width: 110px;padding:5px 0px 0px 0px;">关于我们：</label>
								<div class="layui-input-block">
								    <textarea placeholder="请输入公司介绍" lay-verify="about" name="about" class="layui-textarea" style=" height:250px;"></textarea>
								</div>
							</div>
							<button class="layui-btn" lay-filter="about-add" lay-submit="" id="about-add" style=" margin:30px 0px 0px 110px;">提交</button>
						</form>
					</div>
				</div>
			</div>
		</div>
		<script>
			layui.use(['form', 'layer', 'element'], function() {
				$ = layui.jquery;
				var form = layui.form,
				element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
				layer = layui.layer;//弹出层模块

				//一些事件监听
				element.on('tab(demo)', function(data) {
					console.log(data);
				});
				//自定义验证规则
				form.verify({
					servicePhone: function(value) {
						if(value.length == 0) {
							return '请输入客服电话';
						}
					}/*,
					serviceEmail: function(value) {
						if(value.length == 0) {
							return '请输入客服邮箱';
						}
					},
					weixinCode: function(value) {
						if(value.length == 0) {
							return '请输入微信公众号';
						}
					},
					website: function(value) {
						if(value.length == 0) {
							return '请输入公司网站';
						}
					},
					address: function(value) {
						if(value.length == 0) {
							return '请输入苹果好评地址';
						}
					}*/
				});
				//用户协议
				form.verify({
					agreement: function(value) {
						if(value.length == 0) {
							return '请输入内容';
						}
					}
				});
				//关于我们
				form.verify({
					about: function(value) {
						if(value.length == 0) {
							return '请输入内容';
						}
					}
				});
				//监听基础信息提交
				form.on('submit(set-add)', function(data) {
					console.log(data);
					//发异步，把数据提交给php
					layer.confirm('是否保存？', {
						btn: ['确定', '取消'] //按钮
					}, function() {
						layer.msg('保存成功', {
							icon: 1
						});
					}, function() {
							// 获得frame索引
						var index = parent.layer.getFrameIndex(window.name);
						//关闭当前frame
	       				parent.layer.close(index);
					});
					return false;
				});
				//监听协议提交
				form.on('submit(agreement-add)', function(data) {
					console.log(data);
					//发异步，把数据提交给php
					layer.confirm('是否保存？', {
						btn: ['确定', '取消'] //按钮
					}, function() {
						layer.msg('保存成功', {
							icon: 1
						});
					}, function() {
							// 获得frame索引
						var index = parent.layer.getFrameIndex(window.name);
						//关闭当前frame
	       				parent.layer.close(index);
					});
					return false;
				});
				//监听关于我们提交
				form.on('submit(about-add)', function(data) {
					console.log(data);
					//发异步，把数据提交给php
					layer.confirm('是否保存？', {
						btn: ['确定', '取消'] //按钮
					}, function() {
						layer.msg('保存成功', {
							icon: 1
						});
					}, function() {
							// 获得frame索引
						var index = parent.layer.getFrameIndex(window.name);
						//关闭当前frame
	       				parent.layer.close(index);
					});
					return false;
				});
			});
		</script>
	</body>
</html>